package com.ajieee.merge.controller.sys;

import com.ajieee.merge.entity.common.result.ApiResult;
import com.ajieee.merge.entity.sys.dto.LoginInfoDTO;
import com.ajieee.merge.entity.sys.vo.TokenVO;
import com.ajieee.merge.service.AuthService;
import lombok.RequiredArgsConstructor;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 认证鉴权接口
 *
 * @author ajieee
 * @date 2025-10-25
 */
@RestController
@RequiredArgsConstructor
@RequestMapping("/auth")
public class AuthController {

	private final AuthService authService;

	/**
	 * 登录接口
	 */
	@PostMapping("/login")
	public ApiResult<TokenVO> login(@Validated @RequestBody LoginInfoDTO loginInfoDTO) {
		TokenVO tokenVO = authService.login(loginInfoDTO);
		return ApiResult.success(tokenVO);
	}

}
